@extends('layouts.app', ['activePage' => 'zone', 'titlePage' => __('交流圈管理')])

@section('content')
  <div class="content">
    <div class="container-fluid">
      <div class="row">
        <div class="col-md-12">
          <div class="card">
            <div class="card-header card-header-primary">
              <h4 class="card-title ">{{ __('交流圈列表') }}</h4>
              <p>交流圈查看/标记精品/删除交流圈</p>
            </div>
            <div class="card-body">
              @if (session('status'))
                <div class="row">
                  <div class="col-sm-12">
                    <div class="alert alert-success">
                      <button type="button" class="close" data-dismiss="alert" aria-label="Close">
                        <i class="material-icons">close</i>
                      </button>
                      <span>{{ session('status') }}</span>
                    </div>
                  </div>
                </div>
              @endif
              <div class="row justify-content-end">
                <div class="col-auto">
                  <a href="zone/create" class="btn btn-sm btn-primary" data-toggle="modal" data-target="#createModal"><i class="material-icons">add</i>新建</a>
                </div>
            </div>
            <div class="modal fade" id="createModal" tabindex="-1" role="">
                <div class="modal-dialog modal-login" role="document">
                    <div class="modal-content">
                        <div class="card card-signup card-plain">
                            <div class="modal-header">
                                <h5 class="modal-title" id="exampleModalLongTitle">新建交流圈</h5>
                                <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                                  <span aria-hidden="true">&times;</span>
                                </button>
                              </div>
                            <div class="modal-body">
                                <form class="form" method="post" action="zone">
                                    @csrf
                                    <div class="card-body">
                                        <div class="form-group bmd-form-group">
                                            <div class="input-group">
                                              <div class="input-group-prepend">
                                                <div class="input-group-text"><i class="material-icons">donut_small</i></div>
                                              </div>
                                              <input type="text" class="form-control" name="title" required placeholder="交流圈名称">
                                            </div>
                                        </div>

                                        <div class="form-group bmd-form-group">
                                            <div class="input-group">
                                              <div class="input-group-prepend">
                                                <div class="input-group-text"><i class="material-icons">description</i></div>
                                              </div>
                                              <input type="text" class="form-control" name="desc" required placeholder="交流圈描述">
                                            </div>
                                        </div>
                                    </div>

                                    <div class="text-center">
                                        <button type="submit" class="btn btn-primary">确定</button>
                                    </div>
                                </form>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
              <div class="table-responsive">
                <table class="table">
                  <thead class="text-primary text-center">
                  <th>编号</th>
                  <th>名称</th>
                  <th>介绍</th>
                  <th>操作</th>
                  </thead>
                  <tbody>
                  @foreach($zone as $zone)
                    <tr class="text-center">
                      <td>
                        {{ $loop->iteration }}
                      </td>
                      <td>
                        {{ $zone->title }}
                      </td>
                      <td>
                        {{ $zone->desc }}
                      </td>
                      <td class="td-actions">
                        <a href="#" type="button" rel="tooltip" class="btn btn-success">
                            <i class="material-icons">edit</i>
                        </a>
                          <button onclick="window.location.href='zone/{{$zone->id}}'" type="button" class="btn btn-danger"
                             data-toggle="tooltip"  data-placement="top" title="移除该条交流圈">
                            <i class="material-icons">close</i>
                          </button>
                      </td>
                    </tr>
                  @endforeach
                  </tbody>
                </table>
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
@endsection
